home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
gui
/
gui4cli.lha
/
Gui4Cli
/
Dir
/
Dir.rep
< prev
next >
Wrap
Text File
|
1999-04-21
|
3KB
|
155 lines
G4C
; Dir.rep - GUI for the c:Rep replace command.
; ----------------- The window
WinBig -1 -1 400 100 'Replace in selected files'
WinType 11110001
varpath dir.gc
BOX 0 0 0 0 OUT ICONDROP
; ----------------- General events
xOnLoad
rp_from = ""
rp_to = ""
rp_savemode = OVER
rp_ci = ""
guiopen Dir.rep
RUN 'resident guis:c/Rep pure add'
xOnReload
guiopen dir.rep
xOnClose
delvar rp_#?
guiquit Dir.rep
run 'resident Rep remove'
; ---------------- text-in gadgets for entering..
xTextIn 80 5 310 18 'Replace:' rp_from "" 200 ; string to Rep
gadid 1
setgad dir.rep 2 on ; activate next textin
xTextIn 80 25 310 18 'With:' rp_to "" 200 ; Rep with this
gadid 2
; ---------------- Do we want to add extensions to the files ?
xCycler 10 45 190 14 "" rp_savemode
gadid 3
cstr 'OVERWRITE Files' OVER
cstr 'Add .rep extension' EXT
; ---------------- case insensitive search ?
xCycler 200 45 190 14 "" rp_ci
gadid 6
cstr 'Case Sensitive' ""
cstr 'Case Insensitive' I
; ---------------- A text display, telling you what's going on.
TEXT 15 65 50 14 Status: 20 NOBOX
TEXT 80 65 310 14 Waiting.. 100 BOX
gadid 4
; ---------------- Start converting..
xButton 210 80 90 14 Start
gadid 5
lvmulti first
if $lv_file = ""
ezreq "No files selected!" OK ''
stop
endif
if $$LV_TYPE != FILE
ezreq 'Directories can not\nbe converted!\n\nTry again..\n' OK ""
stop
endif
if $rp_from = ""
ezreq 'No "Replace:" defined!' OK ""
stop
endif
rp_flag = 0
rp_destfile = ""
if $rp_savemode = EXT
extract lv_file UNQUOTE rp_fname
appvar rp_fname .rep
rp_destfile = \"$rp_fname\"
endif
gosub dir.rep disable
update Dir.rep 4 'REP: $lv_file'
set deeptrans off
launch 5 'Rep $lv_file \"$rp_from\" \"$rp_to\" $rp_destfile $rp_ci'
set deeptrans on
; Use of the launch command will allow the other GUIs running on
; this instance of Gui4Cli to go about their business normally
xOnReturn 5
update Dir.rep 4 'Finished.'
lvmulti OFF ; set selection off
if $rp_flag != 0 ; check abort flag
rp_flag = 0 ; reset for next time
gosub dir.rep enable
stop
endif
lvmulti next ; get next file
if $lv_file = "" ; no more files
lvdir refresh
gosub dir.rep enable
stop
endif
if $rp_savemode = EXT
extract lv_file UNQUOTE rp_fname
appvar rp_fname .rep
rp_destfile = \"$rp_fname\"
endif
update Dir.rep 4 'REP: $lv_file'
set deeptrans off
launch 5 'Rep $lv_file \"$rp_from\" \"$rp_to\" $rp_destfile $rp_ci'
set deeptrans on
; --------------- Cancel the rest of the files chosen.
xButton 300 80 90 14 Stop
setvar rp_flag 1
; --------------- Routines to disables & enable guis
xRoutine disable
guiwindow dir.gc wait
setgad dir.rep 1 off
setgad dir.rep 2 off
setgad dir.rep 3 off
setgad dir.rep 5 off
setgad dir.rep 6 off
xRoutine enable
guiwindow dir.gc resume
setgad dir.rep 1 on
setgad dir.rep 2 on
setgad dir.rep 3 on
setgad dir.rep 5 on
setgad dir.rep 6 on
xOnFail
gosub dir.rep enable